//
//  MenuBackgroundLayer.m
//  cocos2dFirstTest
//
//  Created by Daniel Alexander on 6/16/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MenuBackgroundLayer.h"


@implementation MenuBackgroundLayer
+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	MenuBackgroundLayer *layer = [MenuBackgroundLayer node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
    //CCDirector *director = [CCDirector sharedDirector];
    
	// return the scene
	return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if( (self=[super init])) {
        
        for (int i = 0; i < 15; ++i)
        {
            for (int j = 0; j < 10; ++j)
            {
                int tmp = 0;
                if (i == 0 || j == 0 || i == 14 || j == 9)
                    tmp = 1;
                CCSprite *floorSprite = [CCSprite spriteWithFile:(tmp == 0 ? @"floor.png" : @"wall.png")];
                
                floorSprite.position = ccp(16+(i*32),16+(j*32));
                
                [self addChild:floorSprite];
            }
        }
        
	}
	return self;
}


// on "dealloc" you need to release all your retained objects
- (void) dealloc
{
	// in case you have something to dealloc, do it in this method
	// in this particular example nothing needs to be released.
	// cocos2d will automatically release all the children (Label)
	
	// don't forget to call "super dealloc"
	[super dealloc];
}

@end
